#!/bin/sh -e

#DEBHELPER#

if command -v suidunregister >/dev/null 2>&1 && [ -e /etc/suid.conf ]; then
  suidunregister -s jwhois /usr/bin/jwhois
  suidunregister -s jwhois /var/cache/jwhois
fi

case "$1" in
  remove)
    rm -f /var/cache/jwhois/jwhois.db.db
    rmdir /var/cache/jwhois 2> /dev/null || true
    ;;
  purge)
    rm -f /var/cache/jwhois
    rmdir /var/cache/jwhois 2> /dev/null || true
    groupdel jwhois || echo "Failed removing group \`jwhois'"
    ;;
  upgrade)
    ;;
  *)
    echo "postrm called with unknown argument \`$1'" >&2
    exit 0
    ;;
esac
